/**
 * 名称 过滤器
 * 将id号过滤为名称
 */
admin.filter("id2name",function(){
    return function(input , map){
        var name = arguments[2]+'_name';
        // console.log(name);
        return map[input][name];
    }
})

.filter("status2name",function(){
    return function(status , statusList ){
        // var name = arguments[2]+'_name';
        // console.log(name);
        return statusList[status];
    }
})

.filter("date2weeks",function(load2scope){
    return function(date , termId ){
    	date = parseInt( date );
    	scope = {};
    	load2scope(['term'] , scope);
    	var curTerm  = scope.map.term[termId];
    	var distance = date - curTerm.term_date;
    	var weekTime = 3600*24*7*1000
    	var weekNum  = Math.ceil(distance / weekTime);
    	var weekArr  = ['星期日' ,'星期一' ,'星期二' ,'星期三' ,'星期四' ,'星期五' ,'星期六' ];
    	var day      = weekArr[ new Date(date).getDay() ];
    	var text     = '第'+weekNum+'周 ' + day;
      return text;
    }
});